$(function() {
    showOtherFileType();
    $("#fileType").change(function() {
        showOtherFileType();
    });
    $("#submit_form").click(function() {
        var version = $("#version").val();
        var tranCode = $("#tranCode").val();
        var merchantID = $("#merchantID").val();
        var agreeId = $("#agreeId").val();
        var fileType = ($("#otherFileType").val())? $("#otherFileType").val() : $("#fileType").val();
        var reqTime = $("#reqTime").val();
        var signType = $("#signType").val();

        var signStr = "version=[" + version + "]" +
            "tranCode=["+tranCode+"]" +
            "merchantID=["+merchantID+"]" +
            "agreeId=["+agreeId+"]" +
            "fileType=["+fileType+"]" +
            "reqTime=["+reqTime+"]" +
            "signType=["+signType+"]" +
            "VerficationCode=[11111aaaaa]";

        //console.log("加密字段："+signStr);
        var signValue = "";
        if(signType == 2) {
            signValue = hex_sha1(signStr);
           //console.log("sha1 signvalue:"+signValue);
        } else {
            signValue = hex_md5(signStr);
            //console.log("md5 signvalue:"+signValue);
        }
        if(signValue) {
            $("#signValue").val(signValue);
        }


        $("#upload_form").submit();
    });
});
var showOtherFileType = function () {
    var val = $("#fileType").val();
    if(val) {
        $("#otherFileTypeSpan").hide();
        $("#otherFileType").val("");
    } else {
        $("#otherFileTypeSpan").show();
    }
}